--- src/dos/vesa.c	2003-01-26 18:22:56.000000000 +0000
+++ src/dos/vesa.c	2003-02-09 17:16:24.000000000 +0000
@@ -46,6 +46,12 @@
 static char vesa_desc[256] = EMPTY_STRING;
 
 
+#define __RAINE_ALLEGRO_HACKS__
+#ifdef __RAINE_ALLEGRO_HACKS__
+static int vesa_scroll_mode;
+static int vesa_line_size;
+#endif
+
 
 GFX_DRIVER gfx_vesa_1 = 
 {
@@ -1184,6 +1190,11 @@
 
    setup_vesa_desc(driver, vbe_version, linear);
 
+#ifdef __RAINE_ALLEGRO_HACKS__
+   vesa_scroll_mode = 0x00;
+   vesa_line_size = ((unsigned long)b->line[1] - (unsigned long)b->line[0]);
+#endif
+
    return b;
 }
 
@@ -1236,11 +1247,15 @@
  */
 static void vesa_vsync()
 {
+#ifdef __RAINE_ALLEGRO_HACKS__
+   vesa_scroll_mode = 0x80;
+   vesa_scroll(vesa_xscroll, vesa_yscroll);
+   vesa_scroll_mode = 0x00;
+#else
    vesa_scroll(vesa_xscroll, vesa_yscroll);
+#endif
 }
 
-
-
 /* vesa_scroll:
  *  Hardware scrolling routine.
  */
@@ -1255,8 +1270,13 @@
    if (_pm_vesa_scroller) {            /* use protected mode interface? */
       seg = _mmio_segment ? _mmio_segment : _default_ds();
 
+#ifdef __RAINE_ALLEGRO_HACKS__
+      a = ((x * BYTES_PER_PIXEL(screen->vtable->color_depth)) +
+	   (y * vesa_line_size)) / 4;
+#else
       a = ((x * BYTES_PER_PIXEL(screen->vtable->color_depth)) +
 	   (y * ((unsigned long)screen->line[1] - (unsigned long)screen->line[0]))) / 4;
+#endif
 
       #ifdef ALLEGRO_GCC
 
@@ -1273,7 +1293,11 @@
 
 	 : "S" (_pm_vesa_scroller),       /* function pointer in esi */
 	   "a" (seg),                     /* IO segment in eax */
+#ifdef __RAINE_ALLEGRO_HACKS__
+	   "b" (vesa_scroll_mode),        /* mode in ebx */
+#else
 	   "b" (0x80),                    /* mode in ebx */
+#endif
 	   "c" (a&0xFFFF),                /* low word of address in ecx */
 	   "d" (a>>16)                    /* high word of address in edx */
 
@@ -1297,7 +1321,11 @@
 	    parm [esi] [eax] [ebx] [ecx] [edx]     \
 	    modify [edi];
 
+#ifdef __RAINE_ALLEGRO_HACKS__
+	    _scroll(_pm_vesa_scroller, seg, vesa_scroll_mode, a&0xFFFF, a>>16);
+#else
 	    _scroll(_pm_vesa_scroller, seg, 0x80, a&0xFFFF, a>>16);
+#endif
 	 }
 
       #else
@@ -1315,14 +1343,18 @@
       __dpmi_int(0x10, &_dpmi_reg); 
       ret = _dpmi_reg.h.ah;
 
+#ifdef __RAINE_ALLEGRO_HACKS__
+      if ((vesa_scroll_mode & 0x80))
+         _vsync_in();
+#else
       _vsync_in();
+#endif
    }
 
    return (ret ? -1 : 0); 
 }
 
 
-
 /* vesa_set_palette_range:
  *  Uses VESA function #9 (VBE 2.0 only) to set the palette.
  */
--- src/graphics.c	2003-01-26 18:22:56.000000000 +0000
+++ src/graphics.c	2003-02-09 17:12:22.000000000 +0000
@@ -21,7 +21,7 @@
 #include "allegro.h"
 #include "allegro/internal/aintern.h"
 
-
+#define __RAINE_ALLEGRO_HACKS__
 
 static int gfx_virgin = TRUE;          /* is the graphics system active? */
 
@@ -1438,6 +1438,8 @@
    if ((!gfx_driver->scroll) || (_dispsw_status))
       return -1;
 
+#ifndef __RAINE_ALLEGRO_HACKS__
+
    /* clip x */
    if (x < 0) {
       x = 0;
@@ -1460,6 +1462,7 @@
 	 ret = -1;
       }
    }
+#endif
 
    /* scroll! */
    if (gfx_driver->scroll(x, y) != 0)
--- src/misc/modex.c	2003-01-26 18:22:56.000000000 +0000
+++ src/misc/modex.c	2003-02-09 16:59:32.000000000 +0000
@@ -853,7 +853,9 @@
 
    DISABLE();
 
-   _vsync_out_h();
+   // OMAR-Start
+   //_vsync_out_h();
+   // OMAR-End
 
    /* write to VGA address registers */
    _write_vga_register(_crtc, 0x0D, (a>>2) & 0xFF);
@@ -883,7 +885,9 @@
 
    DISABLE();
 
-   _vsync_out_h();
+   // OMAR-Start
+   //_vsync_out_h();
+   // OMAR-End
 
    /* write to VGA address registers */
    _write_vga_register(_crtc, 0x0D, (a>>2) & 0xFF);
--- src/misc/vga.c	2003-01-26 18:22:56.000000000 +0000
+++ src/misc/vga.c	2003-02-09 16:57:42.000000000 +0000
@@ -29,6 +29,8 @@
 #include "allegro/internal/aintern.h"
 #include "allegro/internal/aintvga.h"
 
+#define __RAINE_ALLEGRO_HACKS__
+
 #ifdef ALLEGRO_INTERNAL_HEADER
    #include ALLEGRO_INTERNAL_HEADER
 #endif
@@ -324,7 +326,9 @@
 
    DISABLE();
 
+#ifndef __RAINE_ALLEGRO_HACKS__
    _vsync_out_h();
+#endif
 
    /* write to VGA address registers */
    _write_vga_register(_crtc, 0x0D, a & 0xFF);
@@ -332,7 +336,9 @@
 
    ENABLE();
 
+#ifndef __RAINE_ALLEGRO_HACKS__
    _vsync_in();
+#endif
 
    return 0;
 }
